//package cn.tedu.smartos.family_user.service.impl;
//
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.security.core.userdetails.UserDetails;
//import org.springframework.security.core.userdetails.UserDetailsService;
//import org.springframework.security.core.userdetails.UsernameNotFoundException;
//import org.springframework.security.crypto.password.PasswordEncoder;
//import org.springframework.stereotype.Service;
//
//import java.util.Collections;
//
//@Service
//public class CustomUserDetailsService implements UserDetailsService {
//
//    @Autowired
//    private PasswordEncoder passwordEncoder;
//
//    @Override
//    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
//        // 硬编码测试用户 - 实际应从数据库查询
//        if ("user".equals(username)) {
//            // 使用BCrypt加密密码 (123456)
//            String encodedPassword = passwordEncoder.encode("123456");
//            return new CustomUserDetails(
//                    1L,
//                    "user",
//                    encodedPassword,
//                    Collections.emptyList()
//            );
//        }
//        throw new UsernameNotFoundException("用户不存在: " + username);
//    }
//}